package com.cloud.mall.usr.service;

import com.cloud.mall.api.CommonPage;
import com.cloud.mall.base.BaseResponse;
import com.cloud.mall.user.input.UmsResourceCategoryInpDTO;
import com.cloud.mall.user.input.UmsResourceInpDTO;
import com.cloud.mall.user.output.UmsResourceCategoryOut;
import com.cloud.mall.user.output.UmsResourceOut;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "资源管理接口")
@RequestMapping("/resource")
public interface UmsResourceService {

    @ApiOperation("添加后台资源管理")
    @PostMapping("/create")
    BaseResponse create( @RequestBody UmsResourceInpDTO umsResourceInpDTO);

    @ApiOperation("修改后台资源管理")
    @PostMapping("/update/{id}")
    BaseResponse update(@PathVariable Long id,
                        @RequestBody UmsResourceInpDTO umsResourceInpDTO);

    @ApiOperation("根据ID删除资源管理")
    @PostMapping("/delete/{id}")
    BaseResponse delete(@PathVariable Long id);

    @ApiOperation("根据ID获取资源详情")
    @GetMapping("/{id}")
    BaseResponse<UmsResourceOut> getItem(@PathVariable Long id);

    @ApiOperation("查询所有后台资源")
    @GetMapping("/listAll")
    BaseResponse<List<UmsResourceOut>> listAll();

    @ApiOperation("分页模糊查询后台资源")
    @GetMapping("/list")
    BaseResponse<CommonPage<UmsResourceOut>> list(@RequestParam(required = false) Long categoryId,
                                                  @RequestParam(required = false) String nameKeyword,
                                                  @RequestParam(required = false) String urlKeyword,
                                                  @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                  @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum);

}
